package com.ruoyi.project.hcy.product.service.impl;

import com.ruoyi.project.hcy.product.domain.img.ProImg;
import com.ruoyi.project.hcy.product.mapper.ProImgMapper;
import com.ruoyi.project.hcy.product.service.IProImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName ProImgServiceImpl
 * @Author SAI
 * @Date 2020/9/18 15:47
 * @Description ProImgServiceImpl
 * @Version 1.0
 */
@Service
public class ProImgServiceImpl implements IProImgService {

    @Autowired
    private ProImgMapper proImgMapper;

    @Override
    public ProImg insertUrl(String finalFileName) {
        String url = "/img/hcy/" + finalFileName;
        ProImg proImg = new ProImg();
        proImg.setImgUrl(url);
        int i = proImgMapper.insertUrl(proImg);
        if (i>0) {
            return proImg;
        }
        return null;
    }

    @Override
    public ProImg selectImgById(Long imgId) {
        return proImgMapper.selectImgById(imgId);
    }
}
